package com.st.shopadmin.controller;

import com.github.pagehelper.PageInfo;
import com.st.shopadmin.common.ServerResponse;
import com.st.shopadmin.service.RechargeMoneyLogService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/manage/money/")
public class RechargeMoneyLogController {
    @Autowired
    private RechargeMoneyLogService moneyLogService;

    @RequestMapping("/to_list.do")
    public String task()  {
        return "moneylog/list";
    }

    /**
     * class_name: RechargeMoneyLogController
     * package: com.st.shopadmin.controller
     * describe: 用户充值明细（前端分页）
     * author: duhongpeng
     * date: 2018/10/31
     * time: 15:46
     **/
    @RequestMapping("list.do")
    @ResponseBody
    public ServerResponse list(HttpServletRequest httpServletRequest,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ServerResponse<List> serverResponse = moneyLogService.list(pageNum,pageSize);
        serverResponse.setTotal(serverResponse.getData().size());
        return serverResponse;
    }
    /**
     * class_name: RechargeMoneyLogController
     * package: com.st.shopadmin.controller
     * describe: 用户充值明细（后端分页）
     * author: duhongpeng
     * date: 2018/10/31
     * time: 15:46
     **/
    @RequestMapping("page.do")
    @ResponseBody
    public ServerResponse page(HttpServletRequest httpServletRequest,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){
        ServerResponse<PageInfo> serverResponse = moneyLogService.page(pageNum,pageSize);
        return serverResponse;
    }

}
